<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="f" uri="http://www.jspxcms.com/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>网站管理平台 - Powered by 珍医网</title>
    <jsp:include page="/WEB-INF/views/commons/head.jsp"></jsp:include>
    <script type="text/javascript">
        $(function () {
            $("#validForm").validate();
            $("input[name='name']").focus();
        });
        function confirmDelete() {
            return confirm("<s:message code='confirmDelete'/>");
        }
    </script>
</head>
<body class="c-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="c-bar margin-top5">
    <span class="c-position"><s:message code="doctor.management"/> - <s:message code="${oprt=='edit' ? 'edit' : 'create'}"/></span>
</div>
<form id="validForm" action="${oprt=='edit' ? 'update' : 'save'}.do" method="post">
    <tags:search_params/>
    <f:hidden name="oid" value="${bean.id}"/>
    <f:hidden name="position" value="${position}"/>
    <f:hidden name="did" value="${did}"/>
    <input type="hidden" id="redirect" name="redirect" value="edit"/>
    <table border="0" cellpadding="0" cellspacing="0" class="in-tb margin-top5">
        <tr>
            <td colspan="4" class="in-opt">
                <shiro:hasPermission name="plug:doctor:create">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="create"/>" onclick="location.href='create.do?${searchstring}&did=${did}';"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                    <div class="in-btn"></div>
                </shiro:hasPermission>
                <shiro:hasPermission name="plug:doctor:copy">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="copy"/>" onclick="location.href='create.do?id=${bean.id}&${searchstring}&did=${did}';"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                </shiro:hasPermission>
                <shiro:hasPermission name="plug:doctor:delete">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="delete"/>" onclick="if(confirmDelete()){location.href='delete.do?ids=${bean.id}&${searchstring}&did=${did}';}"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                </shiro:hasPermission>
                <div class="in-btn">
                    <input type="button" value="<s:message code="prev"/>" onclick="location.href='edit.do?id=${side.prev.id}&position=${position-1}&${searchstring}&did=${did}';"
                            <c:if test="${empty side.prev}"> disabled="disabled"</c:if>/></div>
                <div class="in-btn">
                    <input type="button" value="<s:message code="next"/>" onclick="location.href='edit.do?id=${side.next.id}&position=${position+1}&${searchstring}&did=${did}';"
                            <c:if test="${empty side.next}"> disabled="disabled"</c:if>/></div>
                <div class="in-btn">
                    <input type="button" value="<s:message code="return"/>" onclick="location.href='list.do?${searchstring}&did=${did}';"/>
                </div>
                <div style="clear:both;"></div>
            </td>
        </tr>
        <tr>
            <td class="in-lab" width="15%"><em class="required">*</em>医生名称:</td>
            <td class="in-ctt" width="35%">
                <f:text name="fDoctorName" value="${oprt=='edit' ? (bean.fDoctorName) : ''}" class="required" maxlength="100" style="width:180px;"/></td>
        </tr>
        <tr>
            <td class="in-lab" width="15%"><em class="required">*</em>医生介绍:</td>
            <td class="in-ctt" width="35%">
                <f:text name="fDoctorIntroduce" value="${bean.fDoctorIntroduce}" maxlength="100" style="width:180px;"/></td>
        </tr>
        <tr>
            <td class="in-lab" width="15%">医生职称:</td>
            <td class="in-ctt" width="35%">
                <f:text name="fDoctorTitle" value="${bean.fDoctorTitle}" maxlength="100" style="width:180px;"/></td>
        </tr>

        <tr>
            <td class="in-lab" width="15%">擅长的疾病:</td>
            <td class="in-ctt">
                <c:forEach items="${diseases}" var="disease">
                    <input type="checkbox" name="diseases" value="${disease.id}"
                           <c:if test="${disease.checked}">
                           checked="checked"
                           </c:if>
                           /> ${disease.fDiseaseName} &nbsp;
                </c:forEach>
            </td>
        </tr>

        <tr>
            <td class="in-lab" width="15%">头像/照片:</td>

            <td>
                <script type="text/javascript">
                    function fn_smallImage(src) {
                        Cms.scaleImg("img_smallImage", 120, 120, src);
                    }
                </script>
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="320">
                            <div>
                                <input type="text" id="smallImage" name="smallImage" value="${bean.fLogo}" style="width:300px;" onchange="fn_smallImage(this.value);"/>
                            </div>
                            <div style="margin-top:2px;">
                                <input id="smallImageButton" type="button" value="选择"/> &nbsp;
                                <script type="text/javascript">
                                    $(function () {
                                        Cms.f7.uploads("smallImage", "smallImage", {
                                            settings: {"title": "选择附件"},
                                            callbacks: {"ok": function (src) {
                                                fn_smallImage(src);
                                            }}
                                        });
                                    });
                                </script>
                                <input type="button" onclick="imgCrop('smallImage');" value="裁剪"/> &nbsp;
                                <span id="smallImageSwfButton"></span><input type="button" value="上传" class="swfbutton"/>
                                &nbsp;
                                <input id="smallImageSwfCancel" type="button" value="取消" onclick="smallImageSwfUpload.cancelQueue();" disabled="disabled"/>
                                <script type="text/javascript">
                                    var smallImageSwfUpload = Cms.swfUploadImage("smallImage", {
                                        file_size_limit: "0",
                                        file_types: "*.*"
                                    });
                                </script>
                            </div>
                            <div style="margin-top:2px;">
                                宽: <input type="text" id="w_smallImage" value="120" style="width:70px;"/> &nbsp;
                                高: <input type="text" id="h_smallImage" value="120" style="width:70px;"/>
                            </div>
                            <div style="margin-top:2px;">
                                <label><input type="checkbox" id="s_smallImage" checked="checked"/>压缩</label> &nbsp;
                                <label><input type="checkbox" id="e_smallImage"/>拉伸</label> &nbsp;
                                <label><input type="checkbox" id="wm_smallImage"/>水印</label>
                            </div>
                            <input type="hidden" id="t_smallImage" value="false"/>
                            <input type="hidden" id="tw_smallImage" value="116"/>
                            <input type="hidden" id="th_smallImage" value="77"/>
                        </td>
                        <td width="0">
                            <div id="smallImageSwfProgress" style="position:absolute;"></div>
                        </td>
                        <td align="center" valign="middle">
                            <img id="img_smallImage" src="${bean.fLogo}" style="display:none;"/>
                        </td>
                    </tr>
                </table>
                <script type="text/javascript">
                    fn_smallImage("${bean.fLogo}");
                </script>


            </td>
        </tr>

        <tr>
            <td colspan="4" class="in-opt">
                <div class="in-btn"><input type="submit" value="<s:message code="save"/>"/></div>
                <div class="in-btn">
                    <input type="submit" value="<s:message code="saveAndReturn"/>" onclick="$('#redirect').val('list');"/>
                </div>
                <c:if test="${oprt=='create'}">
                    <div class="in-btn">
                        <input type="submit" value="<s:message code="saveAndCreate"/>" onclick="$('#redirect').val('create');"/>
                    </div>
                </c:if>
                <div style="clear:both;"></div>
            </td>
        </tr>
    </table>
</form>
</body>
</html>